import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:pornhub_app/components/app_bar/app_bar_view.dart';
import 'package:pornhub_app/utils/color.dart';
import 'package:pornhub_app/utils/extension.dart';

import '../../../components/activity_cell/activity_cell.dart';
import '../../../components/base_refresh/base_refresh_widget.dart';
import '../controllers/my_activity_page_controller.dart';

class MyActivityPage extends GetView<MyActivityPageController> {
  const MyActivityPage({super.key});

  @override
  Widget build(BuildContext context) {
    PreferredSizeWidget _buildAppBar() => AppBarView(
          titleText: '我参与的活动',
        );
    return Scaffold(
      backgroundColor: COLOR.color_111,
      appBar: _buildAppBar(),
      body: BaseRefreshWidget(
        controller,
        child: GetBuilder<MyActivityPageController>(builder: (_) {
          return CustomScrollView(
            slivers: [
              SliverPadding(
                padding: EdgeInsets.only(left: 14.w, right: 14.w, top: 20.w),
                sliver: SliverList.builder(
                    itemCount: controller.activityList.length,
                    itemBuilder: (context, index) {
                      return ActivityCell(
                          index: index,
                          activity: controller.activityList[index]);
                    }),
              )
            ],
          );
        }),
      ),
    );
  }
}
